# -*- coding: utf-8 -*-
from match import Extractor
import regex as re


class RenZuiExtractor(Extractor):

    # 悔罪适用于所有罪名，所以直接返回True
    @staticmethod
    def is_my_job(file_path):
        return True

    @staticmethod
    def extract(text):
        result = {}
        have_ren_zui = re.search(r"(认罪|认罚|愿意退赃|缴纳罚金)", text) is not None
        result["认罪认罚"] = int(have_ren_zui)
        if result["认罪认罚"] == 0:
            result["认罪认罚"] += 2
        return result


if __name__ == '__main__':
    print(RenZuiExtractor.extract("啊啊"))
